package com.grocery.service.impl;

import com.grocery.dao.RegisterDao;
import com.grocery.service.IRegisterService;
import com.grocery.bean.User;
import com.grocery.util.SYS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RegisterService implements IRegisterService {
    @Autowired
    RegisterDao registerDao;
    @Override
    public int doRegister(User user) {
        User user1=registerDao.selectRegister(user);
        user.setPassword(SYS.digest(user.getPassword()));
        if(user1==null){
            registerDao.doRegister(user);
            return 200;
        }else{
            return 100;
        }
    }
}
